package com.project_task.mapper;

import com.github.pagehelper.Page;
import com.project_task.annotation.AutoFill;
import com.project_task.dto.TaskPageQueryDTO;
import com.project_task.entity.Project;
import com.project_task.entity.Task;
import com.project_task.enumeration.OperationType;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;

@Mapper
public interface TaskMapper {

    /**
     * 添加任务
     * @param task
     */
    @Insert("insert into task(project_id, user_id, title, deadline, status, create_time, update_time, is_deleted) " +
            "values(#{projectId}, #{userId}, #{title}, #{deadline}, #{status}, #{createTime}, #{updateTime}, 0)")
    @AutoFill(value = OperationType.INSERT)
    void save(Task task);


    /**
     * 分页查询任务
     * @param taskPageQueryDTO
     * @return
     */
    Page<Project> pageQuery(TaskPageQueryDTO taskPageQueryDTO);
}
